#!/bin/sh

################################################################################
# Copyright 1999-2010 by Nice, srl.,
# Via Milliavacca, 9
# 14100 Asti (AT) - ITALY
# All rights reserved.
#
# This software is the confidential and proprietary information
# of Nice, srl. ("Confidential Information").
# You shall not disclose such Confidential Information
# and shall use it only in accordance with the terms of
# the license agreement you entered into with Nice.
################################################################################

#------------------------------------------------------------------
# This script produces the size of the file to be downloaded
# in its standard output 
#
# Usage: fm.download.size <file_to_download>
#------------------------------------------------------------------

. "${EF_ROOT}/plugins/irods/bin/common"
. "${EF_ROOT}/plugins/ef/lib/functions"
ef_init_environment "$@"

if [ -z "$1" ] ; then
  echo "Missing input parameter: file to download" 1>&2
fi

_fullpath="${1}"

_size=`${IRODS_ICOMMANDS_DIR}/ils -l "${_fullpath}" | "${EF_AWK}" '{print $4;}'`
printf "${_size}"
